package com.xmutca.sso.client;

import com.alibaba.dubbo.config.annotation.Reference;
import com.xmutca.core.common.Result;
import com.xmutca.sso.api.Account;
import com.xmutca.sso.api.server.AccountService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: 彭伟煌(pengweihuang@xmutca.com)
 * @create: 2016-08-08 16:00
 */
@Controller
@RequestMapping
public class AccountController {

    @Reference(version = "1.0.0", group = "sso")
    private AccountService accountService;

    @ResponseBody
    @RequestMapping("/username/{username}")
    public Result<Account> getByUsername(@PathVariable String username) {
        return accountService.getByUsername(username);
    }
}
